-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import YAML with context #288
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're still deciding whether to use this method, please amend and rebase this PR as suggested below, so that it's showing all tests passing and ready for merging.
{%- import_yaml tplroot ~ "/defaults.yaml" as default_settings with context %} | ||
{%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap with context %} | ||
{%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap with context %} | ||
{%- import_yaml tplroot ~ "/osmap.yaml" as osmap with context %} | ||
{%- import_yaml tplroot ~ "/codenamemap.yaml" as codenamemap with context %} | ||
{%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap with context %} | ||
{%- import_yaml tplroot ~ "/cpuarchmap.yaml" as cpuarchmap with context %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Lucianovici Grepping through the .yaml
files, these are the only ones that are using any Jinja for accessing data structures:
docker/osfamilymap.yaml:{%- if grains.os == 'MacOS' %}
docker/osfamilymap.yaml: {%- set rootuser = salt['cmd.run']("stat -f '%Su' /dev/console") %}
docker/osfamilymap.yaml: {%- set rootgroup = salt['cmd.run']("stat -f '%Sg' /dev/console") %}
docker/osfamilymap.yaml:{%- elif grains.os == 'Windows' %}
docker/osfamilymap.yaml: {%- set rootuser = salt['cmd.run']("id -un") %}
docker/osfamilymap.yaml:{%- endif %}
docker/osfamilymap.yaml: {%- if 'oscodename' in grains %}
docker/osfamilymap.yaml: name: deb [arch=amd64] https://download.docker.com/linux/{{ grains.os|lower }} {{ grains.oscodename }} stable
docker/osfamilymap.yaml: {%- endif %}
docker/osfamilymap.yaml: key_url: "https://download.docker.com/linux/{{ grains.os|lower }}/gpg"
docker/osfamilymap.yaml: baseurl: 'https://download.docker.com/linux/{{ grains.os|lower }}/$releasever/$basearch/stable'
docker/osfamilymap.yaml: gpgkey: 'https://download.docker.com/linux/{{ grains.os|lower }}/gpg'
docker/osfamilymap.yaml: rootuser: {{ rootuser | d('') }}
docker/osfamilymap.yaml: rootuser: {{ rootuser | d('') }}
docker/codenamemap.yaml: - linux-image-extra-{{ grains.kernelrelease }}
docker/osmap.yaml: baseurl: 'https://download.docker.com/linux/centos/{{ grains.get('osmajorrelease', '') }}/$basearch/stable'
Thus, we only need to add with context
to those particular imports (as was mentioned in the postgres-formula
PR):
{%- import_yaml tplroot ~ "/defaults.yaml" as default_settings with context %} | |
{%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap with context %} | |
{%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap with context %} | |
{%- import_yaml tplroot ~ "/osmap.yaml" as osmap with context %} | |
{%- import_yaml tplroot ~ "/codenamemap.yaml" as codenamemap with context %} | |
{%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap with context %} | |
{%- import_yaml tplroot ~ "/cpuarchmap.yaml" as cpuarchmap with context %} | |
{%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %} | |
{%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap with context %} | |
{%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %} | |
{%- import_yaml tplroot ~ "/osmap.yaml" as osmap with context %} | |
{%- import_yaml tplroot ~ "/codenamemap.yaml" as codenamemap with context %} | |
{%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap %} | |
{%- import_yaml tplroot ~ "/cpuarchmap.yaml" as cpuarchmap %} |
In fact, this is actually a reminder that we really want to move to our new v5 map.jinja
, which emphasizes moving Jinja out of our YAML files.
Also, #290 has been merged, so if you rebase this PR on top, all the tests should pass.
@Lucianovici When amending the commit, please update the commit message for -Import YAML with context
+fix(map.jinja): import YAML with context |
@danny-smit I see you have some PRs active for this formula, which would benefit from this fix being applied. How about we get this PR merged soon, as one example of what would need to be done in case we're forced to patch the 30+ formulas? |
@myii Thanks, that sounds very good to me. Can I help with that? |
@danny-smit Ah, I've just noticed that this PR was started from the contributor's |
@danny-smit Actually, are you able to commit my suggestion from the review above? If so, I can finish the rest upon squash-merging this PR. |
@myii No, I don't have permission to add commits. |
I've been chatting to @javierbertoli -- we're thinking about rebuilding the |
@danny-smit So we've started fixing the images and most are working now. You can see the CI re-run of #289 here: It's actually wider-reaching than just the |
@myii Nice work. The tests of the CI re-runs are working much better now! |
Using releases from github instead of bintray
Import with context to avoid errors like: